<?php $__env->startSection('content'); ?>

    <div class="admin-content">
        <div class="admin-content-body">
            <div class="am-cf am-padding am-padding-bottom-0">
                <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">小程序线上会员管理</strong> /
                    <small>List</small>
                </div>
            </div>
            <?php echo $__env->make('admin._flash', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
            <hr>

            <div class="am-g">
                <div class="am-u-sm-12 am-u-md-6">
                    <div class="am-btn-toolbar">
                        <div class="am-btn-group am-btn-group-s">

                            <button type="button" class="am-btn am-btn-default delete_all"><span
                                        class="am-icon-trash-o"></span> 删除
                            </button>


                        </div>
                    </div>
                </div>
            </div>
            <div class="am-g">
                <div class="am-u-sm-12 am-u-md-12">
                    <form class="am-form-inline" method="get">
                        <div class="am-form-group">
                            <div class="am-input-group am-input-group-sm">
                                <input type="text" class="am-form-field" name="openid"
                                       value="<?php echo e(Request::input('openid')); ?>" placeholder="openid搜索">
                            </div>
                            <div class="am-input-group am-input-group-sm">
                                <input type="text" class="am-form-field" name="name"
                                       value="<?php echo e(Request::input('name')); ?>" placeholder="姓名搜索">
                            </div>
                            <div class="am-input-group am-input-group-sm">
                                <input type="text" class="am-form-field" name="tel"
                                       value="<?php echo e(Request::input('tel')); ?>" placeholder="手机号搜索">
                            </div>


                            <select data-am-selected="{btnSize: 'sm', maxHeight: 360, searchBox: 1}"
                                    name="store_id">
                                <option value="-1">所有门店</option>
                                <?php $__currentLoopData = $cates; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $c): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value="<?php echo e($c->id); ?>"
                                            <?php if(Request::input('store_id')==$c->id): ?> selected <?php endif; ?>><?php echo e($c->name); ?></option>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </select>
                        </div>

                        <div class="am-form-group" style="margin-top: 3px">
                            <button type="submit" class="am-btn am-btn-default am-btn-sm">查询</button>
                            <a href="/admin/oncustomer" class="am-btn am-btn-default am-btn-sm">重置</a>
                        </div>
                    </form>
                </div>

            </div>
            <hr>


            <div class="am-g">
                <div class="am-u-sm-12">
                    <form class="am-form">
                        <table class="am-table am-table-striped am-table-hover table-main">
                            <thead>
                            <tr style="font-size: 1.6rem">
                                <th><input class="check_all" type="checkbox"></th>
                                <th class="table-id">ID</th>
                                <th class="table-thumb">微信名</th>
                                <th class="table-thumb">头像</th>
                                <th class="table-thumb">性别</th>
                                <th class="table-type">年卡用户</th>
                                <th class="table-type" style="width: 80px">姓名</th>
                                <th class="table-type">电话</th>
                                <th class="table-type" style="width: 120px">账户余额</th>
                                <th class="table-type" style="width: 100px">消费总额</th>
                                <th class="table-type">消费记录</th>
                                <th class="table-type">所属公司</th>
                                <th class="table-type">公司解绑</th>
                                <th class="table-type">年龄</th>
                                <th class="table-type">到店次数</th>
                                <th class="table-type">所属门店</th>
                                <th class="table-type">加入时间</th>
                                <th class="table-type">Bmi变化</th>
                                <th class="table-set">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php $__currentLoopData = $customers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $k=> $c): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr data-id="<?php echo e($c->id); ?>" style="font-size: 1.6rem">
                                    <th><input class="checked_id" name="checked_id[]" value="" type="checkbox"></th>
                                    <td><?php echo e($k+1); ?></td>

                                    <td>
                                        <?php echo e($c->nickname); ?>

                                    </td>
                                    <td><img src="<?php echo e($c->headimgurl); ?> " alt="" height="30" width="30"></td>

                                    <td class="am-hide-sm-only">
                                        <?php if($c->sex == 1): ?>
                                            <span class="am-icon-male  change_attr" style="color:deepskyblue"></span>
                                        <?php else: ?>
                                            <span class="am-icon-female change_attr" style="color:red"></span>
                                        <?php endif; ?>
                                    </td>


                                    <td class="am-hide-sm-only">
                                        <?php if($c->is_member == 1): ?>
                                            <label class="am-btn-success am-btn am-btn-xs am-radius ">
                                                是
                                            </label>
                                        <?php else: ?>
                                            <label class="am-btn-danger am-btn am-btn-xs am-radius ">
                                                否
                                            </label>
                                        <?php endif; ?>
                                    </td>

                                    <td>
                                        <?php echo e($c->name); ?>

                                    </td>
                                    <td>
                                        <?php echo e(isset($c->tel) ? $c->tel : '空'); ?>

                                    </td>
                                    <td>
                                        <?php echo e($c->card_money); ?>元
                                    </td>
                                    <td>
                                        <?php echo e($c->use_price); ?>元
                                    </td>
                                    <td>
                                        <a href="/admin/order/order?oncustomer_id=<?php echo e($c->id); ?>"> <label class="am-btn-danger am-btn am-btn-xs am-radius ">
                                                查看
                                            </label></a>
                                    </td>
                                    <td>

                                        <label class="am-btn am-btn-success am-btn-xs am-radius">
                                            <?php echo e(isset($c['company']['name']) ? $c['company']['name'] : '无'); ?>

                                        </label>

                                    </td>
                                    <td>

                                        <label class="am-btn am-btn-danger am-btn-xs am-radius change_company">
                                            解绑
                                        </label>

                                    </td>
                                    <td>
                                        <?php echo e($c->age); ?>

                                    </td>
                                    <td>
                                        <?php echo e($c->come_time); ?>

                                    </td>
                                    <td>

                                        <label class="am-btn am-btn-danger am-btn-xs am-radius">
                                            <?php echo e($c['store']['name']); ?>

                                        </label>

                                    </td>
                                    <td>
                                         <span class="am-btn am-btn-success am-btn-xs am-radius">
                                       <?php echo e($c->created_at); ?>

                                        </span>
                                    </td>
                                    <td>
                                        <a href="/admin/oncustomer/record/<?php echo e($c->id); ?>"><label class="am-btn-danger am-btn am-btn-xs am-radius gx">
                                            查看
                                        </label></a>
                                    </td>


                                    <td>
                                        <div class="am-btn-toolbar">
                                            <div class="am-btn-group am-btn-group-xs">
                                                <a href="/admin/oncustomer/<?php echo e($c->id); ?>/edit"
                                                   class="am-btn am-btn-secondary am-btn-xs"><span
                                                            class="am-icon-pencil-square-o"></span> 充值
                                                </a>

                                            </div>
                                        </div>
                                    </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>


                            </tbody>
                        </table>
                        共 <?php echo e($customers->total()); ?> 条记录

                        <div class="am-cf">
                            <div class="am-fr">
                                <?php echo $customers->appends(Request::all())->links(); ?>

                            </div>
                        </div>
                        <hr/>
                        <p>注：.....</p>
                    </form>
                </div>

            </div>
        </div>

        <footer class="admin-content-footer">
            <hr>
            <p class="am-padding-left">© 2014 AllMobilize, Inc. Licensed under MIT license.</p>
        </footer>

    </div>


<?php $__env->stopSection(); ?>
<?php $__env->startSection('js'); ?>
    <script>
        $(function () {



            //改变性别
            $('.change_attr').click(function () {
                //   alert(111);

                var id = $(this).parents('tr').data('id');
// console.log(id);exit;
                var _this = $(this);
                $.ajax({
                    type: 'PATCH',
                    url: '/admin/oncustomer/change_attr',
                    data: {id: id},
                    success: function () {
                        _this.toggleClass('am-icon-male am-icon-female');
                        location.href = location.href;

                    }
                })

            })

            //改变性别
            $('.change_company').click(function () {
                //   alert(111);

                var id = $(this).parents('tr').data('id');
// console.log(id);exit;
                var _this = $(this);
                $.ajax({
                    type: 'PATCH',
                    url: '/admin/oncustomer/change_company',
                    data: {id: id},
                    success: function () {

                        location.href = location.href;

                    }
                })

            })





        })
    </script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.admin.application', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>